<template>
  <form @submit="formSubmit">
    <div class='depotEnterDetail'>
      <scroll-view scroll-y>
        <detailList :data="data" type='出库申请业务确认'></detailList>
        <div class="detailList">
            <div class="weui-cells__title header">业务员确认</div>
          <div class="weui-cells weui-cells_after-title">
            <div class="weui-cell">
              <div class="weui-cell__bd must">确认信息</div>
              <div class="weui-cell__ft">
                <myRadio  v-if="data.applyStatus" @check_id="check_id_function" :disabled='editCode' :status="data.applyStatus"></myRadio>
              </div>
            </div>

             <div class="weui-cell">
              <div class="weui-cell__bd">确认备注</div>
              <div class="weui-cell__ft">
                <input maxlength="100" :disabled='editCode'  name="checkRemake" :value="data.checkRemake" placeholder="填写备注" />
              </div>
            </div>

          </div>
        </div>
        <view class="btn-area submit">
          <button formType="submit" v-if="data.applyStatus==1">提交</button>
        </view>
      </scroll-view>
    </div>
  </form>
</template>

<script>
  import Qinniu from '@/components/common/Qinniu'
  import searchTriangle from "@/components/common/searchTriangle"
  import detailList from '@/components/common/detailList'
  import myRadio from '@/components/common/myRadio'

  
  export default {
    data() {
      return {
        data:{
          checkRemake:""
        },
        editCode: true, //编辑，还会查看，亦或者是添加
      }
    },
    methods: {
      is_disabled() {
        let code = this.data.applyStatus
        switch (true) {
          case code == 1: //编辑
            this.editCode = false;
            break;
          default:
            this.editCode = true;
            break; //编辑
        }
      },

      formSubmit: function (e) {
        const params = e.mp.detail.value
        params.checkStatus = this.data.checkStatus? this.data.checkStatus :this.data.applyStatus;
        params.id = this.$mp.query.id ;

        this.$https.postJson("token/authentication/stock_out_apply/check", params).then(res => {
            this.WxValidate.showModal({
              msg: res.data||'提交成功',
            })
        })
      },  
      check_id_function(value){       //是否通过
          this.data.checkStatus = value
      }
    },
     mounted() {
      this.$https.get(`token/authentication/stock_out_apply/view/${this.$mp.query.id}`).then(res => {
          this.data = Object.assign({},this.data,res.data.data);
           this.is_disabled();
      })
    },
    components: {
      Qinniu,searchTriangle,detailList,myRadio
    }
  }
</script>


<style lang="scss" scoped>
  .depotEnterDetail {
    height: 100%;
    box-sizing: border-box;
    scroll-view {
      height: 100%;
    
    }

  
    
  }
</style>
